import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './App.vue'
import router from './router'
import i18n from './plugins/i18n'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import 'element-plus/dist/index.css'
import { Button, Image as VanImage, Divider, Swipe, Grid } from 'vant'
import 'vant/lib/index.css'

// 开发环境下初始化 mock
if (import.meta.env.DEV) {
  await import('./mock/index.js')
}

const app = createApp(App)
const pinia = createPinia()

// 注册所有图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(pinia)
app.use(router)
app.use(i18n)
app.use(ElementPlus)
app.use(Button)
app.use(VanImage)
app.use(Divider)
app.use(Swipe)
app.use(Grid)

app.mount('#app') 